<template>
  <div>
    <van-tabs @click="tiao">
      <van-tab v-for="item in arr" :key="item.id" :title=item.catename ></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { reqHomecate } from "../../../http/http";
export default {
  created() {
    this.getCatelist();
  },
  data() {
    return {
      arr: [],
    };
  },
  methods: {
    async getCatelist() {
      let { data: res } = await reqHomecate();
      if (res.code == 200) {
        this.arr = res.list;
      }
    },
    tiao(index){
      this.$router.push('/list?id=' + this.arr[index].id)
    }
  },
};
</script>

<style>
</style>